﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Manager/SearchMP.master"  CodeBehind="DealersSearch.aspx.cs" Inherits="Agile_E.DearlersSearch" %>

<asp:Content id="SearchDL" ContentPlaceHolderID="MPsearchmain" runat="server">
<div>
<h1>Dealerships:</h1>
<br />
<table width="90%">
<tr>
<td class="SearchTableCell" style="width:22%">Dealership Name:</td>
<td style="width: 100%"><asp:TextBox ID="txtname" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td class="SearchTableCell" style="width: 22%">State:</td>
<td style="width:100%"><asp:DropDownList ID="ddlState" runat="server" DataSourceID="srcState"
        DataTextField="State" DataValueField="State" AppendDataBoundItems="true" >
        <asp:ListItem Text="--SELECT--" Value="-1"></asp:ListItem>
        </asp:DropDownList>
<asp:SqlDataSource ID="srcState" runat="server" 
        SelectCommand="Select Distinct(State) from Dealerships"
        ConnectionString="<%$ ConnectionStrings:TerraNetConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:TerraNetConnectionString.ProviderName %>" ></asp:SqlDataSource>
</td>
</tr>
<tr>
<td class="SearchTableCell" style="width: 22%">Owner:</td>
<td style="width: 100%"><asp:TextBox ID="txtowner" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td class="SearchTableCell" style="width: 22%">Phone:</td>
<td style="width:100%"><asp:TextBox ID="txtPhone" runat="server"></asp:TextBox></td></tr>
</table>
<br />
<asp:Button ID="btnSearch" runat="server" Text="Search" onclick="btnSearch_Click" />&nbsp;
<asp:HyperLink ID="HLaddDeal" runat="server" Text="Add New Dealership" NavigateUrl="~/Manager/AddDealership.aspx"></asp:HyperLink>
</div>
<br />
<div>
<asp:GridView ID="grdDealers" runat="server" BackColor="White" AutoGenerateColumns="false"
        BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" CssClass="CustGridStyle"
        GridLines="Vertical" DataSourceID="srcDealers">
    <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
    <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
    <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
    <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
    <AlternatingRowStyle BackColor="#DCDCDC" />
    <Columns>
        <asp:BoundField HeaderText="Name" DataField="Name" />
        <asp:BoundField HeaderText="Address" DataField="Address" />
        <asp:BoundField HeaderText="Owner" DataField="Owner" />
        <asp:BoundField HeaderText="Phone" DataField="Phone" />
        <asp:BoundField HeaderText="Services" DataField="Services" />
                <asp:HyperLinkField   DataNavigateUrlFields="Dealership_ID" DataNavigateUrlFormatString="getDealership.aspx?dealership={0}"
                 Text="Select" NavigateUrl="~/Manager/getDealership.aspx" />
    </Columns>
    
    </asp:GridView>
    
    <asp:SqlDataSource ID="srcDealers" runat="server" 
        ConnectionString="<%$ ConnectionStrings:TerraNetConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:TerraNetConnectionString.ProviderName %>" ></asp:SqlDataSource>
</div>
</asp:Content>